#include <iostream>
#include <vector>
using namespace std;

class Solution 
{
public:
    int uniquePaths(int m, int n) 
	{
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
		if(m<=0 || n<=0)
			return 0;

		if(m==1 || n==1)
			return 1;

		vector<vector<int> > paths(m);
		for(size_t i=0;i<m;i++)
			paths[i] = vector<int>(n);

		for(size_t i=0;i<n;i++)
			paths[m-1][i] = 1;
		for(size_t i=0;i<m;i++)
			paths[i][n-1] = 1;

		for(size_t i=m-2;i!=-1;i--)
			for(size_t j=n-2;j!=-1;j--)
				paths[i][j] = paths[i][j+1] + paths[i+1][j];

		return paths[0][0];
    }
};

int main()
{
	Solution s;
	int m,n;
	while(cin>>m)
	{
		if(m<=0)
			break;
		cin>>n;
		cout<<s.uniquePaths(m,n)<<endl;
	}
}